<template>
  <div>
<ul>
  <li v-for="(item,index) in list" :key="item">
    {{item}} <button @click='deleteFn(index)'>删除</button>
  </li>
</ul>
  <button @click='add'>生成</button>
  </div>
</template>

<script>
export default {
data(){
  return {
list:[1,3,5]
  }
},
methods:{
  add(){
      this.list.push(Math.floor(Math.random() * 10));
    // this.list.shift()
    
    // this.$set(this.list,0,'{uname:"帅哥"}')
  },
  deleteFn(index){
    this.list.splice(index,1)
  }
}
}
</script>

<style>

</style>
